﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PSTaskDialog;

namespace ArduinoSketch.Core
{
    public partial class HardwareProfileDialog : Form
    {
        public HardwareProfileDialog()
        {
            InitializeComponent();
            this.CreateProfile();
        }

        private void CreateProfile()
        {
            Hardwares _hardware = Utils.LoadHardwardBoard();

            foreach (var profile in _hardware.Profile)
            {
                this.cmbProfile.Items.Add(profile);
            }

            this.cmbProfile.SelectedIndex = -1;
            
        }

        public HardwareProfile GetHardwaresProfile
        {
            get { return (HardwareProfile)this.cmbProfile.SelectedItem; }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.cmbProfile.Text))
            {
                PSTaskDialog.cTaskDialog.MessageBox(
                                    "Warning",
                                    "Create sketch",
                                    "Hardware Profile is not emtry!",
                                    eTaskDialogButtons.OK,
                                    eSysIcons.Warning);
                return;
            }
            this.DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
